package demo;

import org.json.JSONObject;
import com.amarsoft.dexpre.ResourceConfig;
import com.amarsoft.dexpre.bean.Transaction;
import com.amarsoft.dexpre.parser.ServerDataParser;

public class Demo3DataParser extends ServerDataParser {
	
	protected Transaction createTransaction(Object receivedData) throws Exception{
		Transaction trans = null;
		String messStr = null;
		if(receivedData instanceof byte[])
			messStr = new String((byte[])receivedData);
		else
			messStr = (String)receivedData;
		JSONObject jsonObj = new JSONObject(messStr.substring(5));
		
		String serviceCode = jsonObj.getString("SERVICE_CODE");
		trans = ResourceConfig.getTransactionByServiceCode(serviceCode, deployID);
		return trans;
	}
	
}
